package com.template.ejb.rest.exception;

import javax.ejb.EJBException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.ext.ExceptionMapper;

/**
 * 
 * 
 */
public class WebServiceExceptionMapper implements ExceptionMapper<EJBException> {

	/**
	 * 
	 */
	public Response toResponse(EJBException exception) {
		return Response.status(Status.INTERNAL_SERVER_ERROR).entity(
				exception.getMessage()).type(MediaType.TEXT_PLAIN).build();
	}

}
